/*
 * Before compilation and execution, understand what could be the output of the program.
 * Program demostrates call by values does not impact value of calling functions.	
 */

#include <stdio.h>

void
change(int c, int d)
{
	int t;

	printf("We are in change()...\n");
	printf("Addres of c = %u, Address of d = %u\n", &c, &d);
	printf("Before interchange, c = %d, d = %d\n", c, d);

	t = c;
	c = d;
	d = t;

	printf("After interchange, c = %d, d = %d\n\n", c, d);
}

void
swap(int c, int d)
{
	printf("We are in swap()...\n");
	printf("Address of c = %u, Address of d = %u\n", &c, &d);
	printf("Before change(), c = %d, d = %d\n\n", c, d);

	change(c, d);
	printf("Back in swap()...\n");
	printf("After change(), c = %d, d = %d\n\n", c, d);
}

int main()
{
	int c = 10, d = 20;

	printf("We are in main()...\n");
	printf("Address of c = %u, Address of d = %u\n", &c, &d);
	printf("Before swap(). c = %d, d = %d\n\n", c, d);

	swap(c, d);
	printf("Back in main()...\n");
	printf("After swap(), c = %d, d = %d\n", c, d);

	return 0;
}
